import prettytable as py
#显示坐席
def show_ticket(row_num) :
    tb = py.PrettyTable()
    tb.field_names = ['行号','座位1','座位2','座位3','座位4','座位5']
    for i in range(row_num) :
        list = [f'第{i+1}行','有票','有票','有票','有票','有票']
        tb.add_row(list)
    print(tb)

def sell_tickey(row_num,row,column) :
    tb = py.PrettyTable()
    tb.field_names = ['行号', '座位1', '座位2', '座位3', '座位4', '座位5']
    for i in range(row_num) :
        list = [f'第{i+1}行','有票','有票','有票','有票','有票']
        if i+1 == int(row) :
            list[int(column)] = "\033[1;31m已售\033[1;31m"
        tb.add_row(list)
    print(tb)


if __name__=="__main__" :
    row_num = 13
    show_ticket(row_num)
    column = input('请输购买的座位号如13排5号座，应该输入13,5')
    try :
        row,column = column.split(',')
        sell_tickey(row_num, row, column)
    except :
        print('输入格式有误')


